﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace docTissV2
{
    public partial class uc_ObitoNeonatal : UserControl
    {
        private string xPath;
        private string campoEscolhido = "qtdeobitoPrecoce";
        private Microsoft.Office.Interop.Word.ContentControl cc = null;

        public delegate void obitoNeonatalSelectedHandler(string identificacao, string xPath, Microsoft.Office.Interop.Word.ContentControl cc);
        public event obitoNeonatalSelectedHandler obitoNeonatalChanged;

        public uc_ObitoNeonatal(string xPath, Microsoft.Office.Interop.Word.ContentControl contentControl)
        {
            InitializeComponent();

            this.xPath = xPath;
            this.cc = contentControl;

            rbPrecoce.CheckedChanged += new EventHandler(rbPrecoce_CheckedChanged);
            rbTardio.CheckedChanged += new EventHandler(rbTardio_CheckedChanged);
        }
        
        private void btOK_Click(object sender, EventArgs e)
        {
            obitoNeonatalChanged(campoEscolhido, xPath, this.cc);
            Globals.ThisAddIn.CustomTaskPanes.Remove(Globals.ThisAddIn.ObitoNeonatalCTP);
        }

        private void rbPrecoce_CheckedChanged(object sender, EventArgs e)
        {
            if (rbPrecoce.Checked)
                campoEscolhido = "qtdeobitoPrecoce";
        }

        private void rbTardio_CheckedChanged(object sender, EventArgs e)
        {
            if (rbTardio.Checked)
                campoEscolhido = "qtdeobitoTardio";
        }
    }
}
